package com.cea.papyrus.diagram.sequence.ui.validators;

import org.eclipse.jface.dialogs.IInputValidator;

public class UnlimitedNaturalInputValidator implements IInputValidator {

	public String isValid(String newText) {

		if (newText.equals("*")) {
			return null;
		} else {
			try {
				Integer inputInt = Integer.parseInt(newText);
				if (inputInt >= -1) {
					return null;
				} else {
					return "Bad value";
				}

			} catch (NumberFormatException e) {
				return "Bad value";
			}
		}
	}
}
